Skip to content

Forgot password - #39

Merged
jondeandres merged 1 commit into
mainfrom
forgot-password
Nov 17, 2026
Merged

jondeandres merged 1 commit into
mainfrom
forgot-password

Conversation

@jondeandres

Copy link
Copy Markdown
Contributor

Adds forgot password to the desktop app. Depends on nodea-sh/nodea#343, which adds the backend endpoints and the web console pages. Merge and deploy that first.

What changes

  • The sign-in form gets a Forgot password? link. It goes to /forgot-password and carries over the email already typed.
  • /forgot-password calls POST /v1/password-reset with client: "desktop". The backend then builds the emailed link from DESKTOP_FRONTEND_BASE_URL (nodea:// in production), so it is a nodea:///reset-password/<token> deep link.
  • No Rust change. main.rs already forwards every nodea:// URL and DeepLinkListener navigates to its path. I updated that component's comment: it said FRONTEND_BASE_URL is nodea://, but in production that variable is the web console.
  • /reset-password/:token:
    • checks the link and shows the account's email;
    • validates and sets the new password;
    • lands on sign in with the email filled in and a "password was changed" notice;
    • signs the app out locally if it was signed in, since the reset revokes every session;
    • offers a new link when the link has expired, was used, or was replaced.
  • validatePassword moves from SignupPage to src/lib/validation.ts so both forms share it.
  • Demo mode gets mock versions of the three API calls.

Testing

  • tsc && vite build passes.
  • vitest: 32 passed.
  • Playwright: 95 passed, including the new tests/forgot-password.spec.ts. It stubs the three /v1/password-reset routes and runs outside demo mode, so it goes through the real src/lib/api.ts and checks the request bodies ({email, client: "desktop"} and {password}). It covers the full request and reset flow, a weak password and mismatched passwords being refused before anything is sent, and a dead link.
  • Not tested: opening a real emailed nodea:// link in a packaged build. Please check it by hand once #343 is deployed.

A "Forgot password?" link on the sign-in form leads to /forgot-password,
which asks the backend for a reset link with client: "desktop", so the
emailed link is a nodea:///reset-password/<token> deep link back into the
app. /reset-password/:token checks the link, sets the new password, and
lands on sign in with the email filled in and a notice. The reset signs
the account out everywhere, so a signed-in app signs out locally too.

The password rule SignupPage checked moves to src/lib/validation.ts so
both forms share it.

Needs nodea-sh/nodea#343 (the /v1/password-reset endpoints).
@jondeandres
jondeandres merged commit 9b8f006 into main Nov 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant